<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Cache-Control" content="No-Cache">
	<meta http-equiv="Pragma" content="No-Cache">

	<title>운세의 신</title>

	<link rel="stylesheet" type="text/css" href="/css/common.css">
	<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script> 
	<script src="/js/lib/myconfig.jquery.datepicker.js"></script>
	<script src="/js/utility/common_util.js"></script>
	<script src="/js/common_basic.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			
			$("#start_dt").datepicker();
			$("#end_dt").datepicker();
			$("img.ui-datepicker-trigger").attr("style","margin-left:5px; vertical-align:middle; cursor:pointer;"); //이미지버튼 style적용
			$("#ui-datepicker-div").hide(); //자동으로 생성되는 div객체 숨김 

			$("#btnTodaySetting").click(function() {
				$("#start_dt").val(getStrDate(0));
				$("#end_dt").val(getStrDate(0));
			});
			
			$("#btnWeekSetting").click(function() {
				$("#start_dt").val(getStrDate(-7));
				$("#end_dt").val(getStrDate(0));
			});
			
			$("#btnMonthSetting").click(function() {
				$("#start_dt").val(getStrDate(-31));
				$("#end_dt").val(getStrDate(0));
			});

			$("#btnThisMonthSetting").click(function() {
				var today = new Date();
				var endDay = new Date(today.getFullYear(), today.getMonth()+1, 0);
				var strToday = today.getFullYear() +"-"+ (today.getMonth()+1).lpad(2) +"-"+ "01";
				var strEndDay = endDay.getFullYear() +"-"+ (endDay.getMonth()+1).lpad(2) +"-"+ endDay.getDate();
				$("#start_dt").val(strToday);
				$("#end_dt").val(strEndDay);
			});
			
			$("#btnLastMonthSetting").click(function() {
				var today = new Date();
				var endDay = new Date(today.getFullYear(), today.getMonth()+1, 0);
				var strToday = today.getFullYear() +"-"+ (today.getMonth()).lpad(2) +"-"+ "01";
				var strEndDay = endDay.getFullYear() +"-"+ (endDay.getMonth()).lpad(2) +"-"+ endDay.getDate();
				$("#start_dt").val(strToday);
				$("#end_dt").val(strEndDay);
			});
		});

		// 페이지 이동
		function goPage(page) {
			$("#page").val(page);
			$("#frm").submit();
		}
	</script>
</head>
<body>
<div id="wrap">
	<!-- Header -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/header.php'; ?>
	<!--// Header -->

	<!-- Contents -->
	<div id="content">
		<h2>결제내역 리스트 (취소내역은 확인 불가)</h2>
		<div>
			<form method="get" name="frm" id="frm" action="/statistic/payment_list">
				<input type="hidden" name="page" id="page" value="1" />
				<input type="hidden" name="order" id="order" value="<?=isset($_GET['order']) ? $_GET['order'] : 'artist_name'?>" />
				<input type="hidden" name="sort" id="sort" value="<?=isset($_GET['sort']) ? $_GET['sort'] : 'asc'?>" />
				
<?
	$ptype = isset($_GET['ptype']) ? $_GET['ptype'] : '';
?>
				<fieldset>
					상품종류 : 
					<select name="ptype" id="ptype" title="상품종류 선택">
						<option value="">전체</option>
						<option value="package" <?=$ptype == 'package' ? 'selected="selected"' : ''?>>VIP회원권</option>
						<option value="cash" <?=$ptype == 'cash' ? 'selected="selected"' : ''?>>캐쉬충전</option>
						<option value="ticket" <?=$ptype == 'ticket' ? 'selected="selected"' : ''?>>개별이용권</option>
					</select><br/>
					이름 : <input type="text" name="user_name" id="user_name" value="<?=isset($_GET['user_name']) ? $_GET['user_name'] : ''?>" /><br/>
					아이디 : <input type="text" name="user_id" id="user_id" value="<?=isset($_GET['user_id']) ? $_GET['user_id'] : ''?>" /><br/>
					가입일 : <input type="text" name="start_dt" id="start_dt" value="<?=isset($_GET['start_dt']) ? $_GET['start_dt'] : ''?>" /> ~ <input type="text" name="end_dt" id="end_dt" value="<?=isset($_GET['end_dt']) ? $_GET['end_dt'] : ''?>" />
					<input type="button" value="당일" id="btnTodaySetting" />
					<input type="button" value="당월" id="btnThisMonthSetting" />
					<input type="button" value="전월" id="btnLastMonthSetting" />
					<input type="button" value="최근일주일" id="btnWeekSetting" />
					<input type="button" value="최근한달" id="btnMonthSetting" />
					<br/>
					<input type="submit" value="검색"/> <input type="button" value="검색취소" onclick="location.href='/statistic/payment_list'"/>
					(결과 결제건수 : <?=$total_cnt?>건, 결제금액 : <?=number_format($total_amount)?>원)
				</fieldset>
			</form>
			<table class="basicTable" width="100%" cellpadding="2" cellspacing="1" border="0">
				<thead>
					<tr>
						<th>idx</th>
						<th>거래일시</th>
						<th>회원아이디</th>
						<th>회원명</th>
						<th>주문번호</th>
						<th>상품종류</th>
						<th>상품명</th>
						<th>거래금액</th>
						<th colspan="2">결제방법</th>
						<th>가상계좌</th>
						<th>입금자명</th>
					</tr>
				</thead>
				<tbody>
<?	foreach ($list as $item) : ?>
					<tr>
						<td align="center"><?=$item['idx']?></td>
						<td align="center"><?=substr($item['create_dt'],0,10)?></td>
						<td align="center"><?=$item['user_id']?></td>
						<td align="center"><?=$item['ordnm']?></td>
						<td align="center"><?=$item['ordno']?></td>
						<td align="center"><?=$item['ptype_name']?></td>
						<td align="center"><?=$item['pname']?></td>
						<td align="right"><?=number_format($item['amt'])?></td>
						<td align="center"><?=$item['pgcode']?></td>
						<td align="center"><?=$item['cardname']?></td>
						<td align="center"><?=$item['accountno']?></td>
						<td align="center"><?=$item['accountname']?></td>
					</tr>
<?	endforeach ?>
				</tbody>
				<tfoot>
					<tr>
						<td colspan="15">
							<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/board/page_navi.php'; ?>
						</td>
					</tr>
				</tfoot>
			</table>
		</div>
	</div>
	<!--// Contents -->

	<!-- Footer -->
	<? include_once $_SERVER['DOCUMENT_ROOT'].'/include/commons/footer.php'; ?>
	<!--// Footer -->
</div>
</body>
</html>